---
title: trace_fsslower
sidebar_position: 0
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# trace_fsslower

The trace fsslower gadget streams file operations (open, read, write and fsync)
that are slower than a threshold.

## Requirements

- Minimum Kernel Version : 5.4

## Getting started

Running the gadget:

<Tabs groupId="env">
  <TabItem value="kubectl-gadget" label="kubectl gadget">
```bash
$ kubectl gadget run ghcr.io/inspektor-gadget/gadget/trace_fsslower:%IG_TAG% [flags]
```
  </TabItem>

  <TabItem value="ig" label="ig">
```bash
$ sudo ig run ghcr.io/inspektor-gadget/gadget/trace_fsslower:%IG_TAG% [flags]
```
  </TabItem>
</Tabs>

## Flags

### `--min`

Minimum latency in ms to trace

Default value: "10"

### `--pid`

Show only bind events generated by this particular PID

Default value: ""

### `--filesystem`

Filesystem to trace. Possible values are: btrfs, ext4, fuse, nfs, nfts3 or xfs.

Default value: "ext4"

## Guide

In this guide you'll deploy an example workload that performs some open(),
read() write() and sync() calls and will trace which ones are slower than 1 ms.

Let's start the gadget before running our workload:

<Tabs groupId="env">
  <TabItem value="kubectl-gadget" label="kubectl gadget">
TODO
  </TabItem>

  <TabItem value="ig" label="ig">
```bash
$ sudo ig run trace_fsslower:%IG_TAG%  --verify-image=false --filesystem ext4 --min 1 -c test-trace-fsslower
RUNTIME.CONTAINERNAME     COMM                 PID        TID DELTA_… OFFSET   SIZE FILE         OP
```
  </TabItem>
</Tabs>


Launch a container that will perform input/output operations:

<Tabs groupId="env">
  <TabItem value="kubectl-gadget" label="kubectl gadget">
TODO
  </TabItem>

  <TabItem value="ig" label="ig">
```bash
$ docker run --name test-trace-fsslower -it --rm debian /bin/sh -c "apt-get update && apt-get install -y git"
Get:1 http://deb.debian.org/debian bullseye InRelease [116 kB]
Get:2 http://deb.debian.org/debian-security bullseye-security InRelease [48.4 kB]
...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.
```
  </TabItem>
</Tabs>

The tool will list the I/O operations that were slower than 1ms:

<Tabs groupId="env">
  <TabItem value="kubectl-gadget" label="kubectl gadget">
TODO
  </TabItem>

  <TabItem value="ig" label="ig">
```bash
$ sudo ig run trace_fsslower%IG_TAG% --verify-image=false --filesystem ext4 --min 1 -c test-trace-fsslower
RUNTIME.CONTAINERNAME     COMM                 PID        TID DELTA_… OFFSET   SIZE FILE         OP
test-trace-fsslower       dpkg-preconf…     204239     204239    1008      0 92233… #38586681    F_FSYNC
test-trace-fsslower       dpkg-preconf…     204239     204239    1878      0 92233… #38586683    F_FSYNC
test-trace-fsslower       dpkg              204242     204242    3245      0 92233… perl-module… F_FSYNC
test-trace-fsslower       dpkg              204242     204242    1517      0 92233… libperl5.36… F_FSYNC
test-trace-fsslower       dpkg              204242     204242    1273      0 92233… symbols      F_FSYNC
test-trace-fsslower       dpkg              204242     204242    1285      0 92233… openssl.lis… F_FSYNC
test-trace-fsslower       dpkg              204242     204242    1110      0 92233… ca-certific… F_FSYNC
test-trace-fsslower       dpkg              204242     204242    1310      0 92233… tmp.i        F_FSYNC
test-trace-fsslower       dpkg              204242     204242    6302      0 92233… triggers     F_FSYNC
test-trace-fsslower       dpkg              204242     204242    1435      0 92233… tmp.i        F_FSYNC
test-trace-fsslower       dpkg              204242     204242    1042      0 92233… libkrb5supp… F_FSYNC
test-trace-fsslower       dpkg              204242     204242    1318      0 92233… md5sums      F_FSYNC
test-trace-fsslower       dpkg              204242     204242    1032      0 92233… openssh-cli… F_FSYNC
test-trace-fsslower       dpkg              204242     204242    1063      0 92233… symbols      F_FSYNC
test-trace-fsslower       dpkg              204242     204242    2532      0 92233… git.list-new F_FSYNC
```
  </TabItem>
</Tabs>
